package com.spider.arraylist;

import java.util.ArrayList;

public class ArrayListDemo1 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        list.add("hello");
        list.add("world");
        list.add("java");
        System.out.println(list);
        System.out.println(list.get(0));
        System.out.println(list.get(1));
        System.out.println(list.get(2));
        System.out.println(list.size());
        System.out.println(list.isEmpty());
        System.out.println(list.contains("hello"));// true// 判断是否包含某个元素
        System.out.println("============================");
        //增加元素
        list.add("spider");
        System.out.println(list);
        //在指定位置添加元素
        list.add(3,"javase");
        System.out.println(list);
    }
}
